<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>Termux Web API</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="robots" content="all,follow">
	<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.css">
	<link rel="stylesheet" href="/static/css/style.default.css" id="theme-stylesheet">
</head>

<body>
	<div class="page login-page">
		<div class="container d-flex align-items-center" style="max-width: 900px;">
			<div class="form-holder has-shadow">
				<div class="row">
					<!-- Logo & Information Panel-->
					<div class="col-lg-6">
						<div class="info d-flex align-items-center">
							<div class="content">
								<div class="logo">
									<h1>Termux Web API</h1>
								</div>
								<p>欢迎登录</p>
							</div>
						</div>
					</div>
					<!-- Form Panel    -->
					<div class="col-lg-6 bg-white">
						<div class="form d-flex align-items-center">
							<div class="content">
								<form method="post" action="{% url 'login' %}" class="form-validate" id="loginFrom">
{% csrf_token %}
									<div class="form-group">
									  <input id="login-username" type="text" name="username" required data-msg="请输入用户名" placeholder="用户名" value="admin" class="input-material">
									</div>
									<div class="form-group">
									  <input id="login-password" type="password" name="password" required data-msg="请输入密码" placeholder="密码" class="input-material">
									</div>
									<button id="login" type="submit" class="btn btn-primary">登录</button>

								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- JavaScript files-->
	<script src="/static/js/jquery.min.js"></script>
	<script src="/static/bootstrap/js/bootstrap.js"></script>
	<script src="/static/vendor/jquery-validation/jquery.validate.min.js"></script>
	<!-- Main File-->
	<script src="/static/js/front.js"></script>
	<script>
    	$(function(){
    		/*判断上次是否勾选记住密码和自动登录*/
    		var check1s=localStorage.getItem("check1");
    		var check2s=localStorage.getItem("check2");
    		var oldName=localStorage.getItem("username");
    		var oldPass=localStorage.getItem("password");
    		if(check1s=="true"){
    			 $("#login-username").val(oldName);
    			 $("#login-password").val(oldPass);
    			 $("#check1").prop('checked',true);
    		}else{
    			 $("#login-username").val('');
    			 $("#login-password").val('');
    			 $("#check1").prop('checked',false);
    		}
    		if(check2s=="true"){
    			$("#check2").prop('checked',true);
    			$("#loginFrom").submit();
    			//location="https://www.baidu.com?userName="+oldName+"&passWord="+oldPass;//添加退出当前账号功能
    		}else{
    			$("#check2").prop('checked',false);
    		}
    		/*拿到刚刚注册的账号*/
    		/*if(localStorage.getItem("name")!=null){
    			$("#login-username").val(localStorage.getItem("name"));
    		}*/
    		/*登录*/
    		$("#login").click(function(){
    			var userName=$("#login-username").val();
    			var passWord=$("#login-password").val();
    			/*获取当前输入的账号密码*/
    			localStorage.setItem("username",userName)
    			localStorage.setItem("password",passWord)
    			/*获取记住密码  自动登录的 checkbox的值*/
    			var check1 = $("#check1").prop('checked');
	    		var check2 = $('#check2').prop('checked');
	    		localStorage.setItem("check1",check1);
	    		localStorage.setItem("check2",check2);
    		})

	</script>
</body>

</html>